//
//  UserInfo.m
//  ArchiveDemo
//
//  Created by shk on 14/12/8.
//  Copyright (c) 2014年 com.shk. All rights reserved.
//

#import "UserInfo.h"

#define AGE @"age"
#define NAME @"name"
#define EMAIL @"email"
#define PASSWORD @"password"

@implementation UserInfo


-(void) encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeInt:_age forKey:AGE];
    [aCoder encodeObject:_name forKey:NAME];
    [aCoder encodeObject:_email forKey:EMAIL];
    [aCoder encodeObject:_password forKey:PASSWORD];
    
}

-(id) initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    if(self != nil){
        _age = [aDecoder decodeIntForKey:AGE];
        self.name = [aDecoder decodeObjectForKey:NAME];
        self.email = [aDecoder decodeObjectForKey:EMAIL];
        self.password = [aDecoder decodeObjectForKey:PASSWORD];
    }
    return self;
}

//重写父类的该函数
-(NSString*) description{
    NSString *str = [NSString stringWithFormat:@"age=%d, name=%@, email=%@, password=%@", _age, _name, _email, _password];
    return str;
}



@end
